package cn.xfdzx.android.apps.shop.adapter;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.core.graphics.ColorUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.CategoryAllBeen;

public class MarketLeftMenuAdapter extends BaseQuickAdapter<CategoryAllBeen.DataBean.ChildBean, BaseViewHolder> {
    int p =0;
    public MarketLeftMenuAdapter() {
        super(R.layout.adapter_market_left);
    }

    public  void  selItem(int p){
        this.p=p;
        notifyDataSetChanged();
    }
    @Override
    protected void convert(BaseViewHolder helper, CategoryAllBeen.DataBean.ChildBean item) {

        helper.setText(R.id.tv_left_title,item.getName());

        TextView tv_view = helper.getView(R.id.tv_left_title);
        View view = helper.getView(R.id.view_status);
        RelativeLayout relativeLayout = helper.getView(R.id.rel_title);

        if (helper.getLayoutPosition()==p) {
            tv_view.setTextColor(Color.parseColor("#02C557"));
            view.setVisibility(View.VISIBLE);
            relativeLayout.setBackgroundColor(mContext.getResources().getColor(R.color.colorPrimaryDark));
        }else {
            tv_view.setTextColor(Color.parseColor("#333333"));
            view.setVisibility(View.GONE);
            relativeLayout.setBackgroundColor(mContext.getResources().getColor(R.color.color_F5F5F5));

        }

    }
}
